﻿<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ include file="/common/meta.jsp"%>
<%@ include file="/common/content.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>用户信息管理</title>
<script>
$(document).ready(function(){
	if($.browser.msie)
		window.attachEvent('onbeforeunload',function(){$("#submitButton").val("请等待").attr("disabled","true");});
	else//在chrome中不起作用
 		window.addEventListener('onbeforeunload',function(){$("#submitButton").val("请等待").attr("disabled","true");});
 //初始化地址
  addressInit('cmbProvince', 'cmbArea', 'county', '广东', '${users.area}', '');
  $("#area").change(function(){
		 	$("#showArea").val($(this).val());
   });

		$("#name").focus();
		$("#userForm").validate({
			 rules: { 
			 	loginName: 
			 	{ 
			 		required: true, 
        			maxlength:12,
        			remote: "memberAgentAction!checkName.action?orgName=''&math="+Math.random(),
        			isLoginName: true
			 	},
				name: { 
        			required: true, 
        			maxlength:12
    			},
    			password: {
    				required: true, 
        			maxlength:16,
        			maxlength:12
    			},
    			repassword: {
    				required: true, 
        			maxlength:16,
        			maxlength:12
    			},
    			workphone:
    			{
    				isPhoneCall: true,
    				maxlength:50
    			},
    			workunit: {
    				required: true,
    				maxlength:50
    			},
    			address: {
                    required: true , 
        			maxlength:30
    			},
            	email: {
                    email: true, 
        			maxlength:25
    			},
        	    fax:{
        	    	isPhoneCall: true,
        	    	maxlength:25
				},
            	 mobile: {
                         isPhoneCall: true,
			 			maxlength:50
				},
				walletbalance: {
					required: true, 
			        number:true,
			        maxlength:10
        	    }
			},
			messages: {
				loginName: {
					remote: "该用户已存在"
				}
			},
			success: function(label) {
				label.html("&nbsp;").addClass("checked");
	        }	
		});
	});		
 </script>
	</head>
	<body>
		<div class="rhead">
		<div class="rpos">当前位置: 用户管理  - 添加用户信息</div>
		<div class="ropt"><input type="button" value="返回" onclick="history.back()"/></div>
		<div class="clear"></div>
		</div>
		<form action="memberAgentAction!add.action" method="post" id="userForm"
		 name="userForm">
		<input type="hidden" name="userType" value="${userType}"/>
		<table  align="center" class="listTable3" width="90%">
			<tr>
				<td width="60px"  class="pn-flabel">用户名</td><td><input type="text" name="loginName"/></td>
			</tr>
			<tr>
				<td  class="pn-flabel">密码</td>
				<td>
					<input type="password" name="password"/>
				</td>
			</tr>
			<tr>
				<td  class="pn-flabel">重复密码</td>
				<td>
					<input type="password" name="repassword"/>
				</td>
			</tr>
			<tr>
				<td  class="pn-flabel">真实名字</td><td><input type="text" name="name"/></td>
			</tr>
			<tr>
			  <td  class="pn-flabel">所属角色</td>
			  <td><!-- 省级管理员或者超级管理员 -->
			      <c:forEach var="roles" items="${rolesList}">
			      <c:if test="${((roles.id==3 && users.id==1) or roles.id!=3)&&isAdmin!=2}">
					<input type="checkbox" value="${roles.id}" name="checkmenu"/>${roles.name}&nbsp;&nbsp;
					</c:if>
					<c:if test="${isAdmin==2&&roles.id==4}">
					<input type="checkbox" value="${roles.id}" name="checkmenu" checked/>${roles.name}&nbsp;&nbsp;
					</c:if>
				  </c:forEach>
				  
				  
			  </td>
			</tr>
			<tr>
				<td  class="pn-flabel">工作单位</td><td><input type="text" name="workunit" value=""/></td>
			</tr>
			<tr>
				<td class="pn-flabel">区/县</td>
				<td>
					<select id="cmbProvince" disabled></select>省&nbsp;&nbsp;
					<select id="cmbArea"  <c:if test="${isAdmin==2}">  disabled</c:if>></select>市&nbsp; &nbsp;
					<select id="county" name="county"></select>区/县&nbsp;&nbsp;
				</td>
			</tr>

			 <!--<tr>
				<td  class="pn-flabel">身份证号码</td><td><input type="text" name="address"/></td>
			</tr>  -->
			<tr>
				<td class="pn-flabel">地址</td><td><input type="text" name="address"  value="${tusers.address}"/></td>
			</tr>			
			 <tr>
				<td  class="pn-flabel">联系电话</td><td><input type="text" name="workphone"/></td>
			</tr>
			<tr>
				<td  class="pn-flabel">传真号码</td><td><input type="text" name="fax"/></td>
			</tr>
			
			<tr>
				<td  class="pn-flabel">联系E-mail</td><td><input type="text" name="email"/></td>
			</tr>
			<tr>
				<td class="pn-flabel">移动电话</td><td><input type="text" name="mobile"/></td>
			</tr>
			<tr>
				<td class="pn-flabel">钱包余额</td><td><input type="text" name="walletbalance" /></td>
			</tr>
			<tr>
				<td class="pn-flabel">状态</td>
				<td>
					<select name="state">
						<option value="1">已启用</option>
						<option value="0"><font color="red">已停用</font></option>
					</select>
				</td>
			</tr>
			<tr>
				<td></td>
				<td  align="center" align="center">
				<input type="submit" id="submitButton" value=" 提 交 "/>
				<input type="button" value=" 返 回 " onclick="history.back()"/>
			
				</td>
			</tr>
	 	</table>
	</form>
	</body>
</html>

